package pearson.automation.forms.courseDetails.module;

import java.util.HashMap;

import org.openqa.selenium.By;

import framework.elements.Button;
import framework.elements.Label;

public class LearningObjectivesForm extends SectionForm {

    private static final Label identifyer = new Label(By.cssSelector("h1[class*='module-title']"), "Learning Objectives");
    private final Button addObjective = new Button(By.linkText("Add Learning Objective"), "Add Learning Objective");
    private final HashMap<String, ObjectivesForm> objectives = new HashMap<String, ObjectivesForm>();
    
    public LearningObjectivesForm() {
    super(identifyer.getLocator(), identifyer.getName());
    }
    
    public void initObjectives(String[] objectiveNames) {
    for (String objectiveName:objectiveNames) {
        objectives.put(objectiveName, new ObjectivesForm(objectiveName));
    }
    }
    
    public void clickAddObjective() {
    addObjective.clickAndWait();
    }
    
    public ObjectivesForm getObjective(String name) {
    return objectives.get(name);
    }
}
